package com.lucky.back.service.impl;

import com.lucky.back.ex.ServiceException;
import com.lucky.back.mapper.AddressMapper;
import com.lucky.back.mapper.AnnouncementMapper;
import com.lucky.back.pojo.dto.AddressAddNewDTO;
import com.lucky.back.pojo.dto.AnnouncementAddNewDTO;
import com.lucky.back.pojo.dto.AnnouncementUpdateDTO;
import com.lucky.back.pojo.entity.Address;
import com.lucky.back.pojo.entity.Announcement;
import com.lucky.back.pojo.vo.AddressListItemVO;
import com.lucky.back.pojo.vo.AddressStandarVO;
import com.lucky.back.pojo.vo.AnnouncementListItemVO;
import com.lucky.back.pojo.vo.AnnouncementStandardVO;
import com.lucky.back.service.IAddressService;
import com.lucky.back.service.IAnnouncementService;
import com.lucky.back.web.ServiceCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class AddressServiceImpl implements IAddressService{
    @Autowired
    AddressMapper addressMapper;


    @Override
    public void addNew(AddressAddNewDTO addressAddNewDTO) {
        log.debug("开始处理【添加地址】的业务，参数：{}", addressAddNewDTO);
        // 创建announcement对象
        Address address= new Address();
        // 将参数DTO中的数据复制到announcement对象中
        BeanUtils.copyProperties(addressAddNewDTO, address);
        log.debug("即将插入公告数据：{}", address);
        // 调用Mapper对象的insert()方法，插入公告数据
        addressMapper.insert(address);
    }

    @Override
    public void delete(Long id) {

    }

    @Override
    public void updateInfoById(Long id, AddressAddNewDTO addressAddNewDTO) {

    }

    @Override
    public AddressStandarVO getStandardById(Long id) {
        log.debug("开始处理查询地址服务");
      AddressStandarVO addressStandarVO=  addressMapper.getStandardById(id);
        return addressStandarVO;
    }

    @Override
    public List<AddressListItemVO> list() {
        return null;
    }
}
